<?php
session_start(); // Trengs i starten av fila, for å bruke php sessions.
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="description" content="Studenkel, Startsiden for deg som er student ved UIA!">
<meta name="keywords" content="Studenkel, Student, Enkel, UIA, Universitetet I Agder, Agder Universitet, Studie, IT, Skole, Lenker, Student ressurs, Linker, Skole linker, IS107">

<link rel="icon" type="image/jpg" href="wc2.jpg">
<title>StudEnkel </title>
<!-- Koblinger til Javascript og css filene.-->
<script type="text/javascript" src="script.js"></script>

<!-- jquery -->
<script src="jquery/jquery-1.9.js"></script>
<script src="jquery/jquery-ui.js"></script>
<script src="jquery.ui.datepicker-nn.js"></script>
<!--ipicture, jacascript for kart og css-->
<link rel="stylesheet" type="text/css" href="kart.ipicture/iPicture.css">
<link rel="stylesheet" media="screen" type="text/css" href="colorpicker.css" /> <!-- colorpicker css til skingen.php -->
<script src="kart.ipicture/jquery.ipicture.js"></script>

<!-- jquery UI css -->
<link rel="stylesheet" href="Skins/jquery UI/ui_styles.css" />



<!-- Skin valg -->
<?php

if(isset($_SESSION['skin'])){
$skin = "Skins/".$_SESSION['skin']."/styles.css";
}
else {
$skin = "Skins/default/styles.css";
}
echo '<link rel="stylesheet" type="text/css" href="'. $skin .'">';
?>
<!-- viewport tagen endrer "synsfeltet" til enheten til å ikke zoome ut som er standard. Brukes for mobil kompatabilitet med "Media Queries (se stylesheet)-->
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"/>
</head>
<body>
    <div id="wrapper">
        <div id="header">
        <a href="index.php">
		<img class="logo" src="wc2.jpg"><h1><a href="index.php">StudEnkel <b id="undertittel"> -Startsiden for deg som student!</b></a></h1>         
		</a>
        
        <?php
        //Om vi ikke er logget inn ( $_SESSION['user'] ikke finens ) - Vis login formen
    if(!isset($_SESSION['user'])){
    ?>

    <form method="post" action="login.php">
<input name="user" type="text" placeholder="Brukernavn" autofocus required> <input name="password" type="password" placeholder="Passord" required> <input type="submit" value="Logg inn"><br>
<a href="#" onclick='vindu()'><img src="bilder/info.png" width=20 height=20 alt="informasjon">Info</a><img src="bilder/login.png" style="margin-left:10px"><a href="register.php">Ny bruker?</a><img src="bilder/contact.png" style="margin-left:10px"><a href="kontakt.php">Kontakt</a> <img src="bilder/login.png" style="margin-left:10px"><a href="forgot_password.php">Glemt passord?</a>
</form>
    <?php
    }
    // Vi er logget inn
    else {
    $admin = "";
    if(isset($_SESSION['admin'])){ $admin="<a href=admin.php>[ADMIN]  </a>"; }
    
    echo "<span id=\"login_data\">";
    echo "Logged in as: ".$admin."<a href=profile.php?id=".$_SESSION['user'].">".$_SESSION['user']. "</a><br>";
    echo "<a href=\"#\" onclick='vindu()'><img src=\"bilder/info.png\" width=20 height=20 alt=\"informasjon\">Info</a><img src=\"bilder/chat.png\" style=\"margin-left:10px\"><a href=\"chat.php\">Chat</a> <img src=\"bilder/settings.png\" style=\"margin-left: 10px\"><a href=\"settings.php\">Innstillinger</a> <img src=\"bilder/login.png\" style=\"margin-left: 10px\"><a href=\"logout.php\"><span>Logg ut</span></a> <img src=\"bilder/contact.png\" style=\"margin-left: 10px\"><a href=\"kontakt.php\"><span>Kontakt</span></a>";
    echo "</span>";
    }
    ?>
        
        </div>
